package com.qs.enums;


import java.util.HashMap;
import java.util.Map;

/**
 * 操作类型
 */
public enum OperateType {
	GFZ(1, "挂风障操作"),
	MBMF(2, "建造木板密封墙操作"),
	ZMF(3, "建造砖密封墙操作"),
	JMP(4, "架木棚操作"),
	TFJ(5, "安装局部通风机和接风筒操作"),
	MHJ(6, "安装高倍数泡沫灭火机操作"),
	DXQT(7, "安装惰性气体发生装置或惰泡装置操作"),
	JSG(8, "安装接水管操作");
	
	private int value;
	private String title;

	OperateType(int value, String title) {
		this.value = value;
		this.title = title;
	}

    /**
     * 获取枚举值
     * @return 返回枚举值
     */
	public int value() {
		return this.value;
	}

    /**
     * 获取枚举标题
     * @return 返回枚举的标题
     */
	public String title() {
		return this.title;
	}

	private static Map<String, OperateType> titlefinder;
	static {
		titlefinder = new HashMap<String, OperateType>();
		for (OperateType item : OperateType.values())
			titlefinder.put(item.title(), item);

	}

	private static Map<Integer, OperateType> valuefinder;
	static {
		valuefinder = new HashMap<Integer, OperateType>();
		for (OperateType item : OperateType.values())
			valuefinder.put(new Integer(item.value()), item);

	}

	/**
	 * 按照枚举值查找枚举
	 * 
	 * @param value
	 *            数据类型值对象
	 * @return 返回枚举值对象
	 */
	public static OperateType valueOf(int type) {
		return valuefinder.get(new Integer(type));
	}
	
	/**
	 * 按照枚举标题查找枚举值
	 * 
	 * @param value
	 *            数据类型值对象
	 * @return 返回枚举值对象
	 */
	public static OperateType titleOf(String title) {
		return titlefinder.get(title);
	}
	
	public static OperateType[] getMembers() {
		return new OperateType[] {GFZ, MBMF, ZMF, JMP, TFJ, MHJ, DXQT, JSG};
	}
}
